<?php
class Cities_model extends Med_model {

	// ----------------------------------- TABLE ANME
	const tableName="cities";
	function getTableName(){
		return Cities_model::tableName;
	}
	//------------------------------------ ATTRIBUTES
	var $zip;
	var $name;
	var $fromSelected="";
	var $toSelected="";
	
	// ---------------------------------- CONSTRUCTOR
	
	function __construct(){
		parent::__construct();
	}
	// ----------------------------------- Public 
	function getCity($zip){
		$this -> db -> select('id, zip, name');
		$this -> db -> from($this->getTableName());
		$this -> db -> where('zip = ' . $zip);
		$query = $this -> db -> get();
		if($query -> num_rows() == 1){
			return $query->row();
		}else{
			return false;
		}
	}
}
